---
title: Linter Overview
description: An introduction to the bloc linter.
sidebar:
  order: 1
---

import AvoidFlutterImportsWarningSnippet from '~/components/lint/ImportFlutterWarningSnippet.mdx';
import AvoidFlutterImportsWarningOutputSnippet from '~/components/lint/ImportFlutterWarningOutputSnippet.astro';
import InstallBlocToolsSnippet from '~/components/lint/InstallBlocToolsSnippet.astro';
import InstallBlocLintSnippet from '~/components/lint/InstallBlocLintSnippet.astro';
import BlocLintRecommendedAnalysisOptionsSnippet from '~/components/lint/BlocLintRecommendedAnalysisOptionsSnippet.astro';
import RunBlocLintInCurrentDirectorySnippet from '~/components/lint/RunBlocLintInCurrentDirectorySnippet.astro';

Linting is the process of statically analyzing code for potential bugs in
addition to programmatic and stylistic errors.

Bloc has a built-in linter, which can be used through your IDE or the
[`bloc command-line tools`](https://pub.dev/packages/bloc_tools) with the
`bloc lint` command.

With the help of the bloc linter, you can improve the quality of your codebase
and enforce consistency without executing a single line of code.

For example, perhaps you accidentally imported a Flutter dependency into your
cubit:

<AvoidFlutterImportsWarningSnippet />

If properly configured, the bloc linter will point to the import and produce the
following warning:

<AvoidFlutterImportsWarningOutputSnippet />

In the following sections, we'll cover how to install, configure, and customize
the bloc linter so that you can take advantage of static analysis in your
codebase.

## Quick Start

Get started using the bloc linter in just a few quick and easy steps.

:::note

In order to start using bloc you must have the
[Dart SDK](https://dart.dev/get-dart) installed on your machine.

:::

1. Install the [bloc command-line tools](https://pub.dev/packages/bloc_tools)

   <InstallBlocToolsSnippet />

1. Install the [bloc_lint](https://pub.dev/packages/bloc_lint) package

   <InstallBlocLintSnippet />

1. Add an `analysis_options.yaml` to the root of your project with the
   recommended rules

   <BlocLintRecommendedAnalysisOptionsSnippet />

1. Run the linter

   <RunBlocLintInCurrentDirectorySnippet />

That's all there is to it 🎉

Continue reading for a more in-depth look at configuring and customizing the
bloc linter.
